package com.nativetalk.common.util;

/**
 * Created by Peter on 2017/8/24.
 */
public class TypeTrasUtil {

    public static Integer ObjToInteger(Object obj) {
        Integer value = null;
        if (obj == null) {
            throw new NullPointerException("obj is null");
        }

        if (String.class.isInstance(obj)) {
            String str = (String) obj;
            value = Integer.valueOf(str);
        }

        if (Integer.class.isInstance(obj)) {
            value = (Integer) obj;
        }
        return value;
    }
}
